package session;



public class SessionData {
	public String sessionID;
	public Integer version;
	public Long expiration;
	
	public String message;//This is the message to be displayed for homework 3
	public Integer views;//This is the number of view, also for homework 3
	public String values;//A list of WQ servers containing this data

	public SessionData(){
		this.sessionID = "";
		this.version = 0;
		this.expiration = 0l;
		this.message = "";
		this.views = 0;
	}
	
	public SessionData(String sessionID, Integer version, Long expiration,
			String message, Integer views, String values) {
		super();
		this.sessionID = sessionID;
		this.version = version;
		this.expiration = expiration;
		this.message = message;
		this.views = views;
		this.values = values;
	}
	
	public String sessionDataToString(){
		return sessionID + "," + version + "," + expiration + "," + message + "," + views + "," + values;
	}
	
	public SessionData(String dataStr){
		String[] data = dataStr.split(",");
		this.sessionID = data[0];
		this.version = Integer.parseInt(data[1]);
		this.expiration = Long.parseLong(data[2]);
		this.message = data[3];
		this.views = Integer.parseInt(data[4]);
		this.values = data[5];
	}
}
